/*
 * @Author: Clark
 * @Email: haixuanwoTxh@gmail.com
 * @Date: 2023-01-05 10:08:05
 * @LastEditors: Clark
 * @LastEditTime: 2023-01-05 10:11:50
 * @Description: file content
 */

#include "apue.h"

int globvar = 6;

int main()
{
    int var = 88;
    pid_t pid;

    printf("before vfork\n");
    if ((pid = vfork()) < 0)
    {
        err_sys("vfork error");
    }
    else if (0 == pid)
    {
        globvar++;
        var++;
        _exit(0);
    }

    printf("pid = %ld, glob = %d, var = %d\n", (long)getpid(), globvar, var);
    exit(0);
}
